package com.supreme.nettyapp.generalserver.chatserver;

import com.supreme.nettyapp.generalserver.chatserver.service.ChatServerService;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

@Component
@ConditionalOnProperty(prefix = "netty.chat-server", name = "enabled", havingValue = "true")
public class ChatServerStarter {

    @Resource
    private ChatServerService chatServerService;

    @PostConstruct
    private void chatServerStarter() {
        System.out.println("chatServerStarter");
        chatServerService.startNettyServer();
    }
}
